package top.yangbuyi.controller.system;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.yangbuyi.acpect.annotaction.Log;
import top.yangbuyi.acpect.enums.BusinessType;
import top.yangbuyi.dto.OperLogDto;
import top.yangbuyi.service.impl.OperLogService;
import top.yangbuyi.vo.AjaxResult;
import top.yangbuyi.vo.DataGridView;


/**
 * @description: 杨不易网站:www.yangbuyi.top
 * @program: yangbuyiopenHis2020
 * @ClassName: OperLogController
 * @create: 2020-09-01 15:44
 * @author: yangbuyi
 * @since： JDK1.8
 * @OperLogController: 操作日志$
 **/

@RestController
@Slf4j
@RequestMapping("system/operLog")
public class OperLogController {

	  @Autowired
	  private OperLogService operLogService;

	  /**
	   * @Description: 杨不易个人网址:http://yangbuyi.top
	   * 功能描述: 分页查询操作日志
	   * @Author: TeouBle
	   * @Date: 2020/9/1 15:44
	   */
	  @GetMapping("listForPage")
	  public AjaxResult listForPage(OperLogDto operLogDto) {
			DataGridView gridView = operLogService.listForPage(operLogDto);
			return AjaxResult.success("查询成功", gridView.getData(), gridView.getTotal());
	  }

	  /**
	   * 删除
	   */
	  @DeleteMapping("deleteOperLogByIds/{infoIds}")
	  @Log(title = "删除指定操作日志数据", businessType = BusinessType.DELETE)
	  public AjaxResult deleteOperLogByIds(@PathVariable Long[] infoIds) {
			return AjaxResult.toAjax(this.operLogService.deleteOperLogByIds(infoIds));
	  }

	  /**
	   * 清空删除
	   */
	  @DeleteMapping("clearAllOperLog")
	  @Log(title = "清空操作日志数据", businessType = BusinessType.DELETE)
	  public AjaxResult clearAllOperLog() {
			return AjaxResult.toAjax(this.operLogService.clearAllOperLog());
	  }


}
